import { ChannelEnum, type IComponentConfig } from "../../types";

const props: IComponentConfig[] = [{
  type: 'radioGroup',
  component: 'eRadioGroup',
  model: 'labelPosition',
  label: '标题位置',
  defaultValue: 'left',
  props: {
    type: 'button',
    buttonStyle: 'solid',
    dataSource: {
      type: 'static',
      value: [
        {
          option_key: 'left',
          option_desc: '左'
        },
        {
          option_key: 'right',
          option_desc: '右'
        },
        {
          option_key: 'top',
          option_desc: '顶部'
        }
      ]
    }
  }
}, {
  type: 'inputNumber',
  component: 'eInputNumber',
  model: 'labelWidth',
  label: '标题宽度(px)',
  defaultValue: 90,
  props: {
    min: 0,
    step: 5
  }
}]

const lifeCircle: IComponentConfig[] = [{
  type: 'codeEditor',
  component: 'CodeEditor',
  label: '创建(Created)钩子',
  model: 'CreatedHook',
  defaultValue: `function fn(page) {
  // page上有pageMaking组件上暴露的方法
}
    `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  label: '挂载(Mounted)钩子',
  model: 'MountedHook',
  defaultValue: `function fn(page) {
  // page上有pageMaking组件上暴露的方法
}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  label: '卸载(Unmounted)钩子',
  model: 'UnmountedHook',
  defaultValue: `function fn(page) {
  // page上有pageMaking组件上暴露的方法
}
    `
}]

const style: IComponentConfig[] = [{
  type: 'css',
  component: 'CodeEditor',
  label: '',
  model: 'pageStyle',
  props: {
    language: 'css',
    codeHeight: 300
  },
  defaultValue: ``
}]

const watch: IComponentConfig[] = [{
  type: 'watch',
  component: 'DataWatcher',
  label: '',
  model: 'watchers',
  defaultValue: []
}]

const drag = {
  compName: 'ue-page',
  label: '页面',
  classify: {
    label: '页面',
    value: 'page'
  },
  channel: ChannelEnum.PC,
  group: {
    label: '常规',
    value: 'common'
  }
}

export default {
  props,
  lifeCircle,
  style,
  watch,
  drag
}